/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidade;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author bruno
 */
@Entity
@Table(name = "conta_moeda")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ContaMoeda.findAll", query = "SELECT c FROM ContaMoeda c"),
    @NamedQuery(name = "ContaMoeda.findByIdContaMoeda", query = "SELECT c FROM ContaMoeda c WHERE c.idContaMoeda = :idContaMoeda"),
    @NamedQuery(name = "ContaMoeda.findBySaldo", query = "SELECT c FROM ContaMoeda c WHERE c.saldo = :saldo")})
public class ContaMoeda implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idContaMoeda")
    private Integer idContaMoeda;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "saldo")
    private Double saldo;
    @JoinColumn(name = "idMoeda", referencedColumnName = "idMoeda")
    @ManyToOne(optional = false)
    private Moeda idMoeda;
    @JoinColumn(name = "idConta", referencedColumnName = "idConta")
    @ManyToOne(optional = false)
    private Conta idConta;

    public ContaMoeda() {
    }

    public ContaMoeda(Integer idContaMoeda) {
        this.idContaMoeda = idContaMoeda;
    }

    public Integer getIdContaMoeda() {
        return idContaMoeda;
    }

    public void setIdContaMoeda(Integer idContaMoeda) {
        this.idContaMoeda = idContaMoeda;
    }

    public Double getSaldo() {
        return saldo;
    }

    public void setSaldo(Double saldo) {
        this.saldo = saldo;
    }

    public Moeda getIdMoeda() {
        return idMoeda;
    }

    public void setIdMoeda(Moeda idMoeda) {
        this.idMoeda = idMoeda;
    }

    public Conta getIdConta() {
        return idConta;
    }

    public void setIdConta(Conta idConta) {
        this.idConta = idConta;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idContaMoeda != null ? idContaMoeda.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ContaMoeda)) {
            return false;
        }
        ContaMoeda other = (ContaMoeda) object;
        if ((this.idContaMoeda == null && other.idContaMoeda != null) || (this.idContaMoeda != null && !this.idContaMoeda.equals(other.idContaMoeda))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.ContaMoeda[ idContaMoeda=" + idContaMoeda + " ]";
    }
    
}
